<!DOCTYPE html>
<html>
    <head>
        <!-- 页面meta -->
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>传智健康</title>
        <meta name="description" content="传智健康">
        <meta name="keywords" content="传智健康">
        <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
        <!-- 引入样式 -->
        <link rel="stylesheet" href="../css/style.css">
        <script src="../js/jquery.min.js"></script>
        <!-- 引入组件库 -->
        <script src="../js/vue.js"></script>
        <script src="../js/axios-0.18.0.js"></script>
        <script src="../js/echarts.js"></script>

        <style>
            #chart1{
                float: left;
                margin-left: 100px;

            }
            #chart2{
                float: right;
                margin-right: 150px;
            }
            .box1 {
                position: relative;
                border-radius: 3px;
                background :#ecf0f5;
                border-top: 3px solid #3c8dbc;
                padding: 10px;
                margin-bottom: 20px;
                width: 100%;
              /*  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);*/
            }


        </style>

    </head>
    <body class="hold-transition">
    <div id="app">
        <div class="content-header">
            <h1>统计分析<small>套餐占比</small></h1>
            <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
                <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                <el-breadcrumb-item>统计分析</el-breadcrumb-item>
                <el-breadcrumb-item>套餐占比</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
       <!-- <div class="app-container">
            <div class="box">
                &lt;!&ndash; 为 ECharts 准备一个具备大小（宽高）的 DOM &ndash;&gt;
                <div  id="chart1" style="height:700px;width: 300px"></div>
                <div  id="chart2" style="height:700px;width: 300px"></div>
            </div>
        </div>-->
        <div class="app-container">
            <div class="box1" >
                <div class="charts">
                    <div  id="chart1" style="height:600px;width: 400px"></div>
                    <div  id="chart2" style="height:600px;width: 400px"></div>
                </div>
            </div>
        </div>

    </div>
    </body>

    <script type="text/javascript">
        var myChart1 = echarts.init(document.getElementById('chart1'));
        var myChart2 = echarts.init(document.getElementById('chart2'));

        // 填充数据
        axios.get("/report/getMemberPorpertion.do").then((res)=>{
            myChart1.setOption({
                title: {
                    text: '用户年龄占比',
                    subtext: '网站测试数据',
                    left: 'center'
                },
                tooltip: {
                    trigger: 'item',
                    formatter: '{a} <br/>{b} : {c} ({d}%)'
                },
                legend: {
                    orient: 'vertical',
                    left: 'left',
                    //data: ['入职无忧体检套餐（男女通用）', '邮件营销', '联盟广告', '视频广告', '搜索引擎']
                    name:'岁'
                },
                series: [
                    {
                        name: '访问来源',
                        type: 'pie',
                        radius: '55%',
                        center: ['50%', '60%'],
                        data:res.data.data,
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            })
        })

        axios.get("/report/getMemberPorpertionBySex.do").then((res)=>{
            myChart2.setOption({
                title: {
                    text: '用户性别占比',
                    subtext: '测试数据',
                    left: 'center'
                },
                tooltip: {
                    trigger: 'item',
                    formatter: '{a} <br/>{b} : {c} ({d}%)'
                },
                legend: {
                    orient: 'vertical',
                    left: 'left',
                    //data: ['入职无忧体检套餐（男女通用）', '邮件营销', '联盟广告', '视频广告', '搜索引擎']
                },
                series: [
                    {
                        name: '访问来源',
                        type: 'pie',
                        radius: '55%',
                        center: ['50%', '60%'],
                        data:res.data.data ,
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            });
        })

    </script>

</html>

